<!DOCTYPE html>
<html class="x-admin-sm">

<head>
  <meta charset="UTF-8" />
  <title></title>
  <meta name="renderer" content="webkit" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="viewport"
    content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  <link rel="stylesheet" href="./lib/layui/css/layui.css" />
  <link rel="stylesheet" href="./css/font.css" />
  <link rel="stylesheet" href="./css/xadmin.css" />
  <link rel="stylesheet" href="./css/link.css" />
  <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
  <div class="x-nav">
    <span class="layui-breadcrumb">
      <a href="">首页</a>
      <a href="">演示</a>
      <a> <cite>导航元素</cite></a>
    </span>
    <a class="layui-btn layui-btn-small" style="line-height: 1.6em; margin-top: 3px; float: right"
      onclick="location.reload()" title="刷新">
      <i class="layui-icon layui-icon-refresh" style="line-height: 30px"></i></a>
  </div>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title">
          <li class="layui-this">文字链接</li>
          <li class="layui-this-right">图片链接</li>
          <button type="button" class="layui-btn     " id="btnAddCate">
            + 新增
          </button>
        </ul>
        <!--  -->
        <div class="layui-tab-content">
          <!-- 文字链接 -->
          <table class="layui-table" id="lift">
            <colgroup>
              <col width="150" />
              <col width="200" />
              <col />
            </colgroup>
            <thead>
              <tr>
                <th>#</th>
                <th>标题</th>
                <th>连接描述</th>
                <th>连接类型</th>
                <th>链接地址</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              <!-- <tr>
                  <td>贤心</td>
                  <td>2016-11-29</td>
                  <td>人生就像是一场修行</td>
                  <th>操作</th>
                  <th>操作</th>
                  <th>
                    <button type="button" class="layui-btn layui-btn-xs">
                      编辑
                    </button>
                    <button
                      type="button"
                      class="layui-btn layui-btn-danger layui-btn-xs btn-delete"
                      data-id="{{$value.Id}}"
                    >
                      删除
                    </button>
                  </th>
                </tr> -->
            </tbody>
          </table>

          <!-- 图片链接 -->
          <table class="layui-table" id="right">
            <colgroup>
              <col width="150" />
              <col width="200" />
              <col />
            </colgroup>
            <thead>
              <tr>
                <th>#</th>
                <th>链接描述</th>
                <th>链接图片</th>
                <th>连接类型</th>
                <th>链接地址</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody class="img-tpl">
              <!-- <tr>
                  <td>贤心</td>
                  <td>2016-11-29</td>
                  <td>人生就像是一场修行</td>
                  <th>操作</th>
                  <th>操作</th>
                </tr> -->
            </tbody>
          </table>
          <div id="pageBox"></div>
        </div>
      </div>
    </div>
  </div>
  <!-- 文字链接的模板引擎 -->
  <script type="text/html" id="tpl-table">
    {{each data}}
    <tr>
      <td>{{$index+1}}</td>
      <td>{{$value.title}}</td>
      <td>{{$value.des}}</td>
      <td>{{$value.type}}</td>
      <td>{{$value.url}}</td>
      <td>
        <button type="button" class="layui-btn layui-btn-xs btn-edit" id="amend" data-id="{{$value.id}}">编辑</button>
        <button type="button" class="layui-btn layui-btn-danger layui-btn-xs btn-delete" data-id="{{$value.id}}">删除
        </button>


      </td>
    </tr>
    {{/each}}
  </script>
  <!-- 图片链接的模板引擎 -->
  <script type="text/html" id="tpl-img">
    {{each data}}
    <tr>
      <td>{{$index+1}}</td>
      <td>{{$value.des}}</td>
      <td>{{$value.img}}</td>
      <td>{{$value.type}}</td>
      <td>{{$value.url}}</td>
      <td>
        <button type="button" class="layui-btn layui-btn-xs">编辑</button>
        <button type="button" class="layui-btn layui-btn-danger layui-btn-xs " id="btn-delete" data-id="{{$value.id}}">
          删除
        </button>
      </td>
    </tr>
    {{/each}}
  </script>
 
  <!-- 分类可选项的模板结构 -->
  <script type="text/html" id="tpl-cate">
    <option value="">所有分类</option>
    {{each data}}
    <option value="{{$value.Id}}">{{$value.name}}</option>
    {{/each}}
  </script>

  <!-- 添加 -->
  <!-- 添加分类的弹出层 -->
  <script type="text/html" id="dialog-add">
    <form class="layui-form" id="addCateForm" lay-filter="addCateForm">
      <!-- 隐藏域，保存 Id 的值 -->
      <input type="hidden" name="id" />

      <div class="layui-form-item">
        <label class="layui-form-label">*链接类型</label>
        <div class="layui-input-block">
          <input type="text" name="title" required lay-verify="required" placeholder="请输入标题名称" autocomplete="off"
            class="layui-input" />
        </div>
      </div>

      <div class="layui-form-item">
        <label class="layui-form-label">*链接地址</label>
        <div class="layui-input-block">
          <input type="text" name="url" required lay-verify="required" placeholder="请输入链接地址名称" autocomplete="off"
            class="layui-input" />
        </div>
      </div>
      <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">*链接描述</label>
        <div class="layui-input-block">
          <textarea name="des" placeholder="请输入链接描述名称" class="layui-textarea"></textarea>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-submit lay-filter="formDemo">
            确认添加
          </button>
          <button type="reset" class="layui-btn layui-btn-primary">
            重置
          </button>
        </div>
      </div>
    </form>
  </script>

  <!-- 编辑 -->
  <!-- 修改弹出层 -->
  <script type="text/html" id="dialog-edit">
    <form class="layui-form" id="form-edit" lay-filter="form-edit">
      <!-- 隐藏域，保存 Id 的值 -->
      <input type="hidden" name="id" />
      <div class="layui-form-item">
        <label class="layui-form-label">* 链接类型</label>
        <div class="layui-input-block">
          <select name="type" lay-verify="required">
            <option value="0">文字链接</option>
            <option value="0">图片链接</option>
          </select>
        </div>
      </div>

      <div class="layui-form-item">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-block">
          <input type="text" name="title" required lay-verify="required" placeholder=" 东方财富 "  autocomplete="off"
            class="layui-input" />
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label"> 链接地址</label>
        <div class="layui-input-block">
          <input type="text" name="url" required placeholder="http://www.eastmoney.com/" autocomplete="off"
            class="layui-input" />
        </div>
      </div>
      <div class="layui-form-item layui-form-text">
        <label class="layui-form-label"> 链接描述</label>
        <div class="layui-input-block">
          <textarea name="des" placeholder=" 东方财富 " class="layui-textarea"></textarea>
        </div>
      </div>

      <div class="layui-form-item">
        <div class="layui-input-block" id="btn-edd">
          <button class="layui-btn" lay-submit lay-filter="formDemo">
            确认
          </button>
          <button type="reset" class="layui-btn layui-btn-primary">
            取消
          </button>
        </div>
      </div>
    </form>
  </script>
  <!-- 引入jquery -->
  <script src="./js/jquery.min.js"></script>
  <script src="./lib/layui/template-web.js"></script>
  <script src="./lib/layui/layui.all.js"></script>
  <!-- <script src="./lib/layui/layui.js" charset="utf-8"></script> -->
  <script type="text/javascript" src="./js/xadmin.js"></script>
  <!-- 引入自己的js -->
  <script src="./js/link.js"></script>
</body>

</html>